import 'package:flutter/material.dart';


class Test_theme_textThemePage extends StatelessWidget {
  const Test_theme_textThemePage({super.key});

  @override
  Widget build(BuildContext context) {
    final textTheme = Theme.of(context).textTheme;

    final items = [
      {'name': 'displayLarge', 'style': textTheme.displayLarge},
      {'name': 'displayMedium', 'style': textTheme.displayMedium},
      {'name': 'displaySmall', 'style': textTheme.displaySmall},
      {'name': 'headlineLarge', 'style': textTheme.headlineLarge},
      {'name': 'headlineMedium', 'style': textTheme.headlineMedium},
      {'name': 'headlineSmall', 'style': textTheme.headlineSmall},
      {'name': 'titleLarge', 'style': textTheme.titleLarge},
      {'name': 'titleMedium', 'style': textTheme.titleMedium},
      {'name': 'titleSmall', 'style': textTheme.titleSmall},
      {'name': 'bodyLarge', 'style': textTheme.bodyLarge},
      {'name': 'bodyMedium', 'style': textTheme.bodyMedium},
      {'name': 'bodySmall', 'style': textTheme.bodySmall},
      {'name': 'labelLarge', 'style': textTheme.labelLarge},
      {'name': 'labelMedium', 'style': textTheme.labelMedium},
      {'name': 'labelSmall', 'style': textTheme.labelSmall},
    ];

    return Scaffold(
      appBar: AppBar(
        title: const Text("TextTheme 全属性展示"),
      ),
      body: ListView.separated(
        padding: const EdgeInsets.all(16),
        itemCount: items.length,
        separatorBuilder: (context, index) => const Divider(height: 24),
        itemBuilder: (context, index) {
          final item = items[index];
          final style = item['style'] as TextStyle?;
          return Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                item['name'] as String,
                style: style?.copyWith(
                  color: Colors.blue,
                  fontWeight: FontWeight.bold,
                ),
              ),
              const SizedBox(height: 4),
              Text(
                "The quick brown fox jumps over the lazy dog",
                style: style,
              ),
              const SizedBox(height: 2),
              Text(
                "FontSize: ${style?.fontSize ?? 'N/A'}, "
                    "FontWeight: ${style?.fontWeight ?? 'N/A'}, "
                    "LetterSpacing: ${style?.letterSpacing ?? 'N/A'}",
                style: Theme.of(context).textTheme.bodySmall,
              ),
            ],
          );
        },
      ),
    );
  }
}